<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
session_start();
$UserID = $_SESSION['ID'];
$UserName = $_SESSION['UserName'];
$sa_id = $_GET['sa_id'];
include_once('Mysql_connect.inc');//启动连接，连接名：$conn

$result_c = mysqli_query($conn, "SELECT sa_id, member_id FROM member WHERE member_id = '$UserID'");

if ($result_c) {
    echo "You have been joined this Assoc.";

}else {
    $result_j = mysqli_query($conn, "INSERT INTO member
   (`sa_id`, ` member_id`, `member_name`)
    VALUES
   ('$sa_id', '$UserID', '$UserName')" );
    if ($result_j){
        echo 'Your request has been sent';

    }
    else echo 'error';

}

mysqli_free_result($result_c);
mysqli_free_result($result_j);

include_once('Mysql_unconnect.inc'); //断开连接
?>
